package cn.com.generaldata.os.util;

import java.io.StringReader;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

public class TransitionTool {
	@SuppressWarnings("unchecked")
	public static <T> T fromXML(String xml, Class<T> clazz) throws JAXBException {
		JAXBContext jc = JAXBContext.newInstance(clazz);
		Unmarshaller u = jc.createUnmarshaller();
		return (T) u.unmarshal(new StringReader(xml));
	}

}
